{template 'header'}
<div class="layout960 fn-clear mt10">
	<!--{*筛选页左侧*}-->
	<div class="auto-filter-left fn-left ">
		{template 'part_BrandList','auto'}
	</div>
	<!--{*筛选页右侧 start*}-->
	<div class="auto-filter-right fn-right">
		<!--{*搜索*}-->
		{template 'part_KwSearch','auto'}
		{template 'part_Location','auto'}
		<!--筛选项 start-->
		{php $needClean = false}
		{loop $params $p}
		{if $p[value]}
		{php $needClean = true}
		{php break;}
		{/if}
		{/loop}
		{if $levelParents || $needClean}
		<div class="cat-selected fn-clear">
			<ul class="fn-left">
				<li><a href="{url('auto/search')}"><h5 style="color:red;">清空条件:</h5><i class="icon-close"></i></a></li>
				{loop $levelParents $levelSelection}
				<li><a class="jsGo" data-param = 'l' data-value = '{$levelSelection[parentid]}'  href="javascript:void(0)" onclick="return false"><h5>汽车分类:</h5>{$levelSelection[name]}<i class="icon-close"></i></a></li>
				{/loop}
			</ul>
		</div>
		{/if}
		<div class="cat-property">
			{loop $params $param}
			{if $param[selection]}
			<div class="cat-section fn-clear">
				<div class="cat-hd fn-left">{$param[desc]}</div>
				<ul class="fn-left">
					<li
					{if !$search->getSel($param[short])}class="selected"{/if}><a class="jsGo" data-param='{$param[short]}' data-value='0' href="javascript:void(0);" onclick="return false">不限</a></li>
					{php $lcount = 0;}
					{loop $param[selection] $r}
					{if $param[short] == 'e'} {*新能源类型判定*}
					{if $r[parentid]==0}
					<li
					{if $search->getSel($param[short])==$r[arid]}class="selected"{/if}><a class="jsGo" data-param='{$param[short]}' data-value="{$r['arid']}" href="#" onclick="return false;">{$r['name']}</a></li>
					{if $r[arrchildid] != $r[arid]}
					{php $_eids = explode(',',$r[arrchildid])}
					{php array_shift($_eids)}
					<li>[</li>
					{loop $_eids $_eid}
					<li
					{if $search->getSel($param[short])==$_eid}class="selected"{/if}><a class="jsGo" data-param='{$param[short]}' data-value="{$_eid}" href="javascript:void(0);" onclick="return false">{$param[selection][$_eid]['name']}</a></li>
					{/loop}
					<li>]</li>
					{/if}
					{/if}
					{elseif $param[short]=='l'} {*新能源级别添加*}
					{if $r[parentid]==0}
					{php $lcount++}
					{/if}
					<li
					{if $search->getSel($param[short])==$r[arid]}class="selected"{/if}><a class="jsGo" data-param='{$param[short]}' data-value="{$r['arid']}" href="javascript:void(0);" onclick="return false">{$r['name']}</a></li>
					{if $lcount ==3}
					<li{if in_array($search->getSel('e'), array(432,428,429,430,431,432))} class="selected"{/if}><a href="?e=432">新能源车</a></li>
					{/if}
					{else}
					<li
					{if $search->getSel($param[short])==$r[arid]}class="selected"{/if}><a class="jsGo" data-param='{$param[short]}' data-value="{$r['arid']}" href="javascript:void(0);" onclick="return false">{$r['name']}</a></li>
					{/if}
					{/loop}
				</ul>
			</div>
			{/if}
			{/loop}
			{if $extListProps}
			{loop $extListProps $title $props}
			<div class="cat-section fn-clear">
				<div class="cat-hd fn-left">{$title}</div>
				<ul class="fn-left">
					<li
					{if $props[_sel] == 0} class="selected" {/if}><a class="jsGo" data-param='x' data-value="{$props[_empty]}" href="javascript:void(0);" onclick="return false">不限</a></li>
					{loop $props $selKey $propname}
					{if substr($selKey, 0, 1) == '_'}{php continue;}{/if}
					{php $st = 0}
					{loop $propname $key $val}
					<li
					{if $props[_sel] == $props[_cur][$st]} class="selected" {/if}><a class="jsGo" data-param='x' data-value="{$props[_set][$st]}" href="javascript:void(0);" onclick="return false">{$val}</a></li>
					{php $st++}
					{/loop}
					{/loop}
				</ul>
			</div>
			{/loop}
			{/if}
			{if $extCheckboxes}
			<div id="js-filter-other" class="cat-section fn-clear" {if intval($ex) ==0} style="display: none;"{/if} >
			<div class="cat-hd fn-left">其&nbsp;它：</div>
			<ul class="auto-filter-other fn-left">
				{loop $extCheckboxes $title $checkbox}
				{loop $checkbox $key $val}
				{if substr($key, 0, 1) == '_'}{php continue;}{/if}
				<li>
					<input id="ckb_{$key}" class="jsGo"
					{if !$checkbox[_sel]}
                    data-param='x' data-value="{$checkbox[_set]}"
					{else}
                    data-param='x' data-value="{$checkbox[_empty]}"
					{/if}
					type="checkbox" {if $checkbox[_sel]}checked="checked"{/if}
					>
					<label for="ckb_{$key}">{$title}</label>
				</li>
				{/loop}
				{/loop}
			</ul>
		</div>
		{/if}
	</div>
	{if $extListProps || $extCheckboxes}
	<div id="js-filter-more" class="auto-filter-more">
		<a href="javascript:void(0);">更多筛选条件</a><i class="down"></i>
	</div>
	{/if}
    <script>
        seajs.use(['$','lm-util'],function($,util){
            $(".jsGo").click(function(){
                var p = $(this).attr("data-param");
                var v = $(this).attr("data-value");
                util.go(p,v,'search.php');
            });
        })
    </script>
	<!--筛选项 end-->

	<!--筛选结果 start-->
	<div class="auto-filter-results">
		<div class="auto-filter-rhd">
			<ul>
				<li class="selected">在售</li>
				<!--<li>即将上市</li>-->
			</ul>
			<span>共搜索到{if $search->getAcnum()}{$search->getAcnum()}{else}0{/if}个车系，共{if $search->getAmnum()}{$search->getAmnum()}{else}0{/if}个车款</span>
		</div>
		<!--筛选结果列表 start-->
		<div class="auto-fliter-rlist">
			<!--筛选结果单项 start-->
			{if $items}
			{loop $items $car}
			<div class="auto-filter-result">
				<div class="auto-filter-rmodel fn-clear">
					<div class="pic fn-left">
						<a href="{url('auto/car', 'carid='.$car['arid'])}" target="_blank">
							<img src="{Picture::thumb($car[car_thumb], 150, 113)}" width="135" height="85"/>
						</a>
					</div>
					<div class="model-property fn-left">
						<dl>
							<dt><a href="{url('auto/car', 'carid='.$car['arid'])}" target="_blank">{$car[name]}</a></dt>
							<dd class="odd">级别: {$car[cLevel]}</dd>
							<dd>动力类型: {$car[cEngine]}</dd>
							<dd class="odd">排放标准: {$car[cEmission]}</dd>
							<dd>变速箱: {$car[cGearBox]}</dd>
							<dd class="ext">
								<a href="{url('auto/carParam', 'carid='. $car[arid])}" target="_blank">参数配置</a>|
								<a href="{url('auto/pictureList', 'carid='.$car[arid])}" target="_blank">图片</a>
							</dd>
						</dl>
					</div>
					<div class="model-price fn-right">
						<p class="price">官方报价:{$car[cPrice]}</p>
						<a href="{url('auto/car', 'carid='.$car['arid'])}" target="_blank">查看详情>></a>
					</div>
				</div>
				<div class="auto-filter-mbtn close fn-clear"><i class="down"></i>展开符合条件的{$car[cNum]}个车款</div>
				<!--符合条件的车款 start-->
				<div class="auto-filter-rcars fn-left" style="display:none;">
					<table>
						{loop $car[children] $year $models}
						<thead>
						<tr>
							<th width="300">{if $year}{$year}款{else}未知年款{/if}</th>
							<th width="248">官方价</th>
							<th width="170">详情</th>
						</tr>
						</thead>
						<tbody>
						{loop $models $model}
						<tr>
							<td width="300" class="property">
								<h3><a href="{url('auto/model', 'modelid='.$model['amid'])}" target="_blank">{$model[name]}</a></h3>
								<p>{$model[cEngine]} {$model[cEmission]} {$model[cGearBox]}</p>
							</td>
							<td width="248" class="price">
								{$model[cPrice]}
							</td>
							<td width="170" class="detail">
								<a href="{url('auto/carParam', 'carid='. $car[arid])}" target="_blank">参数配置</a>
								<a href="{url('auto/pictureList', 'carid='.$car[arid])}" target="_blank">图片</a>
								<button class="js-compare-btn compare-btn-gray" data-modelType="{$model[modeltype]}" data-modelId="{$model[amid]}" data-fullName="{$car[name]} {$model[name]}">+对比</button>
							</td>
						</tr>
						{/loop}
						</tbody>
						{/loop}
					</table>
				</div>
				<!--符合条件的车款 start-->
			</div>
			{/loop}
			<!--筛选结果单项 end-->

			<!--分页 start-->
			{php $total=$search->getAcnum()}
			{php $pn = $search->getPn()}
			{template 'pager', 'inc'}
			<!--分页 end-->
			{else}
			<!--{template 'noauto', 'message'}-->
			{/if}
		</div>
	</div>
    <script type="text/javascript">
        seajs.use(['$','lm-util'],function($,util){
            //其他筛选条件
            var $moreFilter = $("#js-filter-more"),
                    $otherFilter = $("#js-filter-other"),
                    _moreFilter = false;

            $moreFilter.click(function() {
                if ($otherFilter.queue().length > 0) return;

                var $text = $(this).children("a"),
                        $icon = $(this).children("i");

                if (_moreFilter) {
                    $otherFilter.slideUp(150);
                    _moreFilter = false;
                    $text.text("更多筛选条件");
                    $icon.attr("class", "down")
                } else {
                    $otherFilter.slideDown(150);
                    _moreFilter = true;
                    $text.text("收起筛选条件");
                    $icon.attr("class", "up")
                }
            });

            //筛选结果—符合条件的车款
            var $openBtn = $(".auto-filter-mbtn"),
                    $cars = $(".auto-filter-rcars");

            $openBtn.each(function(index, element) {
                var open = false;
                $(this).click(function() {
                    if (open) {
                        $(this).children("i").removeClass("up").addClass("down");
                        $(this).addClass("close");
                        $cars.eq(index).hide()
                        open = false;
                    } else {
                        $(this).children("i").removeClass("down").addClass("up");
                        $(this).removeClass("close");
                        $cars.eq(index).show();
                        open = true;
                    }
                });
            });

            //在售/即将上市
            util.tab("mouseover","div.auto-filter-rhd", "selected", "div.auto-fliter-rlist");
        });
    </script>
    <!--筛选结果 end-->
    {template 'auto-compare', 'fragment'}
    {template 'footer', 'auto'}
    </div>
	<!--筛选页右侧 end-->
</div>
<!--主体部分 end-->
</body>
</html>
